package com.wsoft.config;

/**
 * 创建一个共享的上下文类,用于存储响应体
 * @Author z001
 * @Date 2024/11/20 10:20
 */
public class ResponseBodyContext {
    private static final ThreadLocal<Object> RESPONSE_BODY_HOLDER = new ThreadLocal<>();
    private static final ThreadLocal<Object> SYS_LOG_INFO = new ThreadLocal<>();

    public static void setResponseBody(Object responseBody) {
        RESPONSE_BODY_HOLDER.set(responseBody);
    }
    public static Object getResponseBody() {
        return RESPONSE_BODY_HOLDER.get();
    }

    public static void setSysLogInfo(Object sysLogInfo) {
        SYS_LOG_INFO.set(sysLogInfo);
    }
    public static Object getSysLogInfo() {
        return SYS_LOG_INFO.get();
    }


    public static void clear() {
        RESPONSE_BODY_HOLDER.remove();
        SYS_LOG_INFO.remove();
    }
}
